﻿using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Text;


namespace Entity
{
    #region 新增永久图文素材
    public class add_news_params
    {
        /// <summary>
        /// 多图文
        /// </summary>
        public List<add_news_articles_item> articles { get; set; }

    }
    public class add_news_articles_item
    {
        /// <summary>
        /// 	标题
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 图文消息的封面图片素材id（必须是永久mediaID）
        /// </summary>
        public string thumb_media_id { get; set; }
        /// <summary>
        /// 作者
        /// </summary>
        public string author { get; set; }
        /// <summary>
        /// 图文消息的摘要，仅有单图文消息才有摘要，多图文此处为空。如果本字段为没有填写，则默认抓取正文前64个字。
        /// </summary>
        public string digest { get; set; }
        /// <summary>
        /// 是否显示封面，0为false，即不显示，1为true，即显示
        /// </summary>
        public int show_cover_pic { get; set; } = 1;
        /// <summary>
        /// 图文消息的具体内容，支持HTML标签，必须少于2万字符，小于1M，且此处会去除JS,涉及图片url必须来源 "上传图文消息内的图片获取URL"接口获取。外部图片url将被过滤。
        /// </summary>
        public string content { get; set; }
        /// <summary>
        /// 图文消息的原文地址，即点击“阅读原文”后的URL
        /// </summary>
        public string content_source_url { get; set; }
        /// <summary>
        /// Uint32 是否打开评论，0不打开，1打开
        /// </summary>
        public int need_open_comment { get; set; }
        /// <summary>
        /// Uint32 是否粉丝才可评论，0所有人可评论，1粉丝才可评论
        /// </summary>
        public int only_fans_can_comment { get; set; }
    }


    public class add_news_result : base_wx_result
    {
        public string media_id { get; set; }
    }
    #endregion
    #region 上传图片
    public class uploadimg_params
    {

        public IFormFile media { get; set; }
    }
    public class uploadimg_result : base_wx_result
    {
        /// <summary>
        ///  返回的图片地址
        /// </summary>
        public string url { get; set; }
    }
    #endregion
    #region 新增其他类型永久素材
    /// <summary>
    /// 新增其他类型永久素材 入参
    /// </summary>
    public class add_material_params
    {
        public string type { get; set; }
    }
    public class add_material_params_postbody
    {
        /// <summary>
        /// 视频素材的标题
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 视频素材的描述
        /// </summary>
        public string introduction { get; set; }
    }

    public class add_material_result : base_wx_result
    {
        /// <summary>
        /// 
        /// </summary>
        public string media_id { get; set; }
        /// <summary>
        //  
        /// </summary>
        public string url { get; set; }
    }
    #endregion
    #region 获取永久素材
    public class get_material_params
    {
        /// <summary>
        ///  素材ID
        /// </summary>
        public string media_id { get; set; }
    }
    public class get_material_result : base_wx_result
    {
        public object news_item { get; set; }

        public string title { get; set; }

        public string description { get; set; }

        public string down_url { get; set; }
    }
    #endregion
    #region 获取永久素材列表

    public class batchget_material_params
    {
        /// <summary>
        /// 素材的类型，图片（image）、视频（video）、语音 （voice）、图文（news）
        /// </summary>
        public string type { get; set; }
        /// <summary>
        /// 从全部素材的该偏移位置开始返回，0表示从第一个素材 返回
        /// </summary>
        public int offset { get; set; } = 0;
        /// <summary>
        /// 返回素材的数量，取值在1到20之间
        /// </summary>
        public int count { get; set; } = 20;
    }

    public class batchget_material_result : base_wx_result
    {
        /// <summary>
        /// 该类型的素材的总数
        /// </summary>
        public int total_count { get; set; }
        /// <summary>
        /// 本次调用获取的素材的数量
        /// </summary>
        public int item_count { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public object item { get; set; }
    }
    #endregion
    #region 获取永久素材数量 

    public class get_materialcount_result : base_wx_result
    {
        /// <summary>
        /// 语音总数量
        /// </summary>
        public int voice_count { get; set; }
        /// <summary>
        /// 视频总数量
        /// </summary>
        public int video_count { get; set; }
        /// <summary>
        /// 图片总数量
        /// </summary>
        public int image_count { get; set; }
        /// <summary>
        /// 图文总数量
        /// </summary>
        public int news_count { get; set; }
    }
    #endregion
    #region 删除素材列表

    public class del_material_params
    {
        public string media_id { get; set; }
    }

    public class del_material_result:base_wx_result
    { 
    }
    #endregion

    #region 修改永久图文素材
    public class update_news_params
    {
        /// <summary>
        /// 要修改的图文消息的id
        /// </summary>
        public string media_id { get; set; }
        /// <summary>
        /// 要更新的文章在图文消息中的位置（多图文消息时，此字段才有意义），第一篇为0
        /// </summary>
        public int index { get; set; }
        /// <summary>
        /// 文章详情
        /// </summary>
        public add_news_articles_item articles { get; set; }
    }

    public class update_news_result : base_wx_result
    {
    }
    #endregion

}
namespace ServiceCore.Tool.Wx.wx_media
{
     
    public class media_config
    { 
        /// <summary>
        /// 定义接口访问集合
        /// </summary>
        public static url_list Api_Url
        {
            get
            {
                url_list result = new url_list();
                return result;
            }
        }
        public class url_list
        {
            /// <summary>
            /// 新增永久图文素材
            /// </summary>
            public string add_news
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/material/add_news";
                }
            }

            /// <summary>
            /// 新增其他类型永久素材
            /// </summary>
            public string uploadimg
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/media/uploadimg";
                }
            }

            /// <summary>
            /// 新增其他类型永久素材
            /// </summary>
            public string add_material
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/material/add_material";
                }
            }
            /// <summary>
            /// 获取永久素材
            /// </summary>
            public string get_material
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/material/get_material";
                }
            }
            /// <summary>
            /// 删除永久素材
            /// </summary>
            public string del_material
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/material/del_material";
                }
            }
            /// <summary>
            /// 获取素材总数
            /// </summary>
            public string get_materialcount
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/material/get_materialcount";
                }
            } 
            /// <summary>
            /// 获取素材列表
            /// </summary>
            public string batchget_material
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/material/batchget_material";
                }
            } 
            /// <summary>
            /// 修改永久图文素材
            /// </summary>
            public string update_news
            {
                get
                {
                    return "https://api.weixin.qq.com/cgi-bin/material/update_news";
                }
            }
        }
    }
}
